home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / ARMLINUX / MAIL / 9804 / 000125_owner-linux-arm…r.rutgers.edu _Tue Apr 21 13:42:24 1998.msg < prev    next >
Internet Message Format  |  1998-05-13  |  3KB

  1. Return-Path: <owner-linux-arm-outgoing@vger.rutgers.edu>
  2. Received: from orava.funet.fi (orava.funet.fi [128.214.248.46])
  3.     by odie.barnet.ac.uk (8.8.6/8.8.6) with ESMTP id NAA24044
  4.     for <willy@odie.fluff.org>; Tue, 21 Apr 1998 13:42:20 +0100
  5. Received: from vger.rutgers.edu ([128.6.190.2]:22680 "EHLO vger.rutgers.edu" ident: "root") by orava.funet.fi with ESMTP id <391184-15032>; Tue, 21 Apr 1998 15:40:05 +0300
  6. Received: by vger.rutgers.edu id <970799-319>; Tue, 21 Apr 1998 08:31:38 -0400
  7. Received: from odie.barnet.ac.uk ([194.82.202.98]:26171 "EHLO odie.barnet.ac.uk" ident: "willy") by vger.rutgers.edu with ESMTP id <970935-319>; Tue, 21 Apr 1998 08:23:45 -0400
  8. Received: (from willy@localhost)
  9.     by odie.barnet.ac.uk (8.8.6/8.8.6) id NAA23939
  10.     for linux-arm@vger.rutgers.edu; Tue, 21 Apr 1998 13:30:25 +0100
  11. From: Matthew Wilcox <willy@odie.barnet.ac.uk>
  12. Message-Id: <199804211230.NAA23939@odie.barnet.ac.uk>
  13. Subject: improved strlen.S
  14. To: linux-arm@vger.rutgers.edu
  15. Date:     Tue, 21 Apr 1998 13:30:20 +0100 (BST)
  16. X-Mailer: ELM [version 2.4 PL25]
  17. MIME-Version: 1.0
  18. Content-Type: text/plain; charset=US-ASCII
  19. Content-Transfer-Encoding: 7bit
  20. X-Orcpt: rfc822;linux-arm@vger.rutgers.edu
  21. Sender: owner-linux-arm@vger.rutgers.edu
  22. Precedence: bulk
  23. X-Loop: majordomo@vger.rutgers.edu
  24. Status: RO
  25.  
  26.  
  27. Thanks to Mark Wooding for providing me with the improved detect-zero-byte
  28. code.  I found a bug in the pre-word case.  This should be suitable for
  29. linux but is /not/ suitable for libc as it does not have the correct
  30. behaviour when the character being searched for is the zero byte.
  31. 44 instructions, but 2 fewer in the inner loop, and a couple removed
  32. from the direct path in.  Anyway:
  33.  
  34. strchr:
  35.    stmfd   r13!, {r14}
  36.    tst     r0, #3
  37.    beq     2f
  38. 1: ldrb    r2, [r0], #1
  39.    cmp     r2, r1
  40.    cmpne   r2, #0
  41.    tstne   r0, #3
  42.    bne     1b
  43.    bcs     6f
  44. 2: orr     r1, r1, r1, LSL #8
  45.    orr     r1, r1, r1, LSL #16
  46.    mov     r14, #1
  47.    orr     r14, r14, r14, LSL #8
  48.    orr     r14, r14, r14, LSL #16
  49. 3: ldr     r2, [r0], #4
  50.    eor     r3, r2, r1
  51.    sub     ip, r3, r14
  52.    bic     ip, ip, r3
  53.    tst     ip, r14, lsl #7
  54.    beq     5f
  55.    sub     ip, r2, r14
  56.    bic     ip, ip, r2
  57.    tst     ip, r14, lsl #7
  58.    bne     3b
  59.    b       7f
  60. 5: tst     r2, #&000000ff
  61.    beq     7f
  62.    tst     r3, #&000000ff
  63.    subeq   r0, r0, #1
  64.    tstne   r3, #&0000ff00
  65.    subeq   r0, r0, #2
  66.    ldmeqfd r13!, {pc}
  67.    tst     r2, #&0000ff00
  68.    tstne   r2, #&00ff0000
  69.    beq     7f
  70.    tst     r3, #&00ff0000
  71.    subeq   r0, r0, #1
  72.    tstne   r3, #&ff000000
  73.    ldmeqfd r13!, {pc}
  74.    b       7f
  75. 6: cmp     r2, #0
  76.    subne   r0, r0, #1
  77. 7: moveq   r0, #0
  78.    ldmfd   r13!, {pc}
  79.  
  80.  
  81. -- 
  82. Set Alias$Case Set Alias$[ |||| |MSet Alias$Otherwise Set Alias$[ \ Matthew
  83. "" |MSet Alias$When If %0=%%0 Then Set Alias$[ "" ||MIf %0=%%0    \ Wilcox
  84. Then Set Alias$Otherwise Set Alias$[ |||||||||||||||| ||MIf       \
  85. %0=%%0 Then Set Alias$When Set Alias$[ ||||||||||||||||
  86. unsubscribe: body of `unsubscribe linux-arm' to majordomo@vger.rutgers.edu